﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Weazel.Willows.RefinedModel
{
	public class PortRegistry
	{
		private List<Weazel.Gezel.Model.Port> ports;

		private int addPort(Weazel.Gezel.Model.Port port)
		{
			ports.Add(port);
			return ports.Count - 1;
		}

		public int this[Weazel.Gezel.Model.Port port]
		{
			get
			{
				return ports.IndexOf(port);
			}
		}

		public Weazel.Gezel.Model.Port this[int index]
		{
			get
			{
				return ports[index];
			}
		}

		public int AddPort(InPort inport)
		{
			return addPort(inport);
		}

		public int AddPort(OutPort outport)
		{
			return addPort(outport);
		}

		public PortRegistry()
		{
			this.ports = new List<Weazel.Gezel.Model.Port>();
		}
	}
}
